#ifndef _GRID_H
#define _GRID_H

class Grid
{
public:
	enum ESquareState
	{
		none,
		free,
		occupied
	};

	struct Square
	{
		Vector3 m_position;
		unsigned int m_x;
		unsigned int m_y;
		ESquareState m_state;
	};

	Grid(void);
	~Grid(void);

	void Init(unsigned int width, unsigned int height, unsigned int square_width, unsigned int square_height);
	void Shut();

	// Get a square based on its location in the grid. x is the column, y is the row
	Square& GetSquare(unsigned int x, unsigned int y);

	// Get a square based on a posiotion in the world. It will look through the grid
	// and check if the position is inside a square.
	Square& GetSquare(Vector3 position);

	void SetState(Square* square, ESquareState state);

protected:
	std::vector<Square*> m_squares;
	unsigned int m_width;
	unsigned int m_height;
	unsigned int m_square_width;
	unsigned int m_square_height;
};

#endif